TARGET = SysInfo SysUpgrade set_mac StmUpgrade ArtUpgrade BootUpgrade

CFG_TARGET = cfg nor check_stm8

LED_TARGET = led_control_reload

XML_CGI_OBJ= main.o cgiget.o cgihandle.o cgipost.o uci_for_cgi.o cgiWireless.o

all: $(TARGET) $(CFG_TARGET) $(LED_TARGET) install


SysInfo: $(XML_CGI_OBJ)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -luci -lxml2 -liw
SysUpgrade:SysUpgrade.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
test_uart:test_uart.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
led_control_reload:led_control_reload.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
cfg:cfg.o uci_for_cgi.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -luci
set_mac:set_mac.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
nor:nor.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
StmUpgrade:StmUpgrade.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
ArtUpgrade:ArtUpgrade.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
BootUpgrade:BootUpgrade.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
check_stm8:check_stm8.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
install:
	mkdir bin
	cp -f $(TARGET) bin/
#	-cp -f $(TARGET) $(CFG_TARGET) ~

 
.PHONY: clean
clean:
	rm -f *.o $(TARGET) $(CFG_TARGET) $(LED_TARGET)

